package main

func isRectangleOverlap(rec1 []int, rec2 []int) bool {
	checkOverLap := func(x1, x2, x3, x4 int) bool {
		if x2 <= x3 {
			return false
		}

		if x4 <= x1 {
			return false
		}

		return true
	}

	if checkOverLap(rec1[0], rec1[2], rec2[0], rec2[2]) && checkOverLap(rec1[1], rec1[3], rec2[1], rec2[3]) {
		return true
	}

	return false
}

func main() {
	isRectangleOverlap([]int{2, 17, 6, 20}, []int{3, 8, 6, 20})
}
